package site.bianma.hybrid.web.controllers

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.ResponseBody
import site.bianma.hybrid.dto.AuthorDTO
import site.bianma.hybrid.service.AuthorService

/**
 * 类描述
 *
 * @author liangrun
 * @create 2018-06-12 17:16
 * @version 1.0
 */
@Controller
@RequestMapping("/authors")
class AuthorController {
    @Autowired
    private lateinit var authorService: AuthorService

    @RequestMapping("/home")
    @ResponseBody
    fun home(name: String): String {
        var author = AuthorDTO()
        author.realName = name
        author.nickName = name
        authorService.add(author)
        return "Success"
    }
}